import { useAPIUtils } from "@/components/APIUtilsProvider";
import { moreModals } from "@/components/moreModals";
import PageLayout from "@/components/PageLayout";
import UserPill from "@/components/UserPill";
import {
  Box,
  Button,
  Card,
  Flex,
  Grid,
  Image,
  Switch,
  Text,
  Title,
} from "@mantine/core";
import { useState } from "react";
import { useParams } from "react-router-dom";
import BusinessUserDetails from "./BusinessUserDetails";
import PartyAUserDetails from "./PartyAUserDetails";

export default function UserDetails() {
  const { id } = useParams();
  const {
    restGET,
    tanstackQuery,
    tanstackInvalidate,
    restPOST,
    restPUT,
    restDELETE,
  } = useAPIUtils();

  const userQuery = tanstackQuery(`/api/admin/users/${id}`);

  if(!userQuery.data){
    return <>loading</>;
  }

  const user = userQuery.data;

  if(user.user.partyA){
    return <PartyAUserDetails />
  }else{
    return <BusinessUserDetails />
  }

}
